﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services.Description;
using Stamp_For_Africa_Version_2.Models;

namespace Stamp_For_Africa_Version_2.Repositories
{
	public class TypeRepository
	{
		private StampsDataContext db = new StampsDataContext();
		//
		// Query Methods

		public IQueryable<StampType> FindAllTypes()
		{
			return db.StampTypes;
		}

		public void AddStampType(StampType stampType)
		{
			db.StampTypes.InsertOnSubmit(stampType);
			Save();
		}

		public StampType GetStampType(Guid id)
		{
			return db.StampTypes.Where(u => u.Id == id).SingleOrDefault();
		}

		public void Save()
		{
			db.SubmitChanges();
		}
	}
}